package com.bookmanager.www.service.impl;

import com.bookmanager.www.entity.FlPayinfo;
import com.bookmanager.www.mapper.FlPayinfoMapper;
import com.bookmanager.www.service.FlPayinfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;

/**
 * <p>
 * 用户支付信息表 服务实现类
 * </p>
 *
 * @author 风离
 * @since 2021-09-17
 */
@Service
public class FlPayinfoServiceImpl extends ServiceImpl<FlPayinfoMapper, FlPayinfo> implements FlPayinfoService {

    @Resource
    FlPayinfoMapper flPayinfoMapper;
    @Override
    public FlPayinfo createPayInfo(String userId,  String payId, String orderId,String payplatform, String platformNumber) {


        //支付类型 1 支付宝支付 2 wx支付
        int payPlatform =Integer.parseInt(payplatform);

        String platformStatus = "已支付";

        LocalDateTime createdTime = LocalDateTime.now();

        LocalDateTime upDateTime = LocalDateTime.now();

        int insertPayInfo =  flPayinfoMapper.createPayInfo(payId,orderId,userId,payPlatform,platformNumber,platformStatus,createdTime,upDateTime);

        FlPayinfo flPayinfo = flPayinfoMapper.selectFlPayInfoByPayId(payId);

        return flPayinfo;
    }
}
